<include file="public+header">

{script}
$(document).ready(function() {
    $("#node_access").change(function() {
        if (this.value != 0){
            $("#ajaxSelect").css('display','block');
		    $("#ajaxSelect").load("{:G::U('node/get_access')}", {
                access: this.value
            });
        }
        else{

            $("#ajaxSelect").css('display','none');
        }
	});
});
{/script}

{script}
<!--
function add(){
	Dyhb.AjaxSubmit('nodeAdd','{:G::U('node/insert')}','',complete);
}
function update(){
	Dyhb.AjaxSubmit('nodeAdd','{:G::U('node/update')}');
}
function complete(data,status){
    if(status==1){

        $('#id').val(data.id);
    }
}

-->
{/script}

   <!-- 标题  -->
   <div class="title"><if condition="empty( $nId )" ><lang>添加节点</lang><else/><lang>编辑节点</lang></if> ( <a href="{:G::U('node/index')}"><lang>返回节点列表</lang></a> )</div>

  <!-- 正文 -->
  <div id="content" class="content">
      <form action="<if condition="empty( $nId )" >{:G::U('node/insert')}<else/>{:G::U('node/update')}</if>" method="post" id="nodeAdd">
      <table class="form-table full">
          <tr>
            <th valign="top"><label for="node_access"><lang>授权</lang>：</label></th>
            <td><SELECT class="field"  name="node_access" id="node_access">
                 <option value="0" <if condition="isset( $arrValue ) && $arrValue['node_level']==1">selected</if>>-- <lang>请选择</lang> --</option>
	             <option value="app" <if condition="isset( $arrValue ) && $arrValue['node_level']==2">selected</if>><lang>应用</lang></option>
	             <option value="module" <if condition="isset( $arrValue ) && $arrValue['node_level']==3">selected</if>><lang>模块</lang></option>
	             </SELECT>
	             <div class="description"><lang>请选择授权应用和模块</lang></div>
            </td>
          </tr>
          <tr class="none" id="ajaxSelect"><td><img
			src="__TMPLPUB__/Images/ajaxloading.gif"></img><lang>数据加载中...</lang>
            <if condition="empty( $nId )"><input type="hidden" name="node_level" value="1"></if>
            <input type="hidden" name="node_parentid" value="<if condition="isset( $arrValue ) && $arrValue['node_parentid']">{$arrValue['node_parentid']}<else/>0</if>"></td>
          </tr>
          <tr>
            <th valign="top"><label for="node_sort"><lang>序号</lang>：</label></th>
            <td><input type="text" name="node_sort" id="node_sort" class="field" size="40"  value="<if condition="isset( $arrValue ) && $arrValue['node_sort']">{$arrValue['node_sort']}<else/>0</if>"/>
            <div class="description"><lang>节点序号，用于排列节点顺序</lang></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="node_name"><lang>应用名</lang>：</label></th>
            <td><input type="text" name="node_name" id="node_name" class="field" size="40" value="<if condition="isset( $arrValue )">{$arrValue['node_name']}</if>"/>
            <div class="description"><lang>节点的名字</lang></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="node_title"><lang>显示名</lang>：</label></th>
            <td><input type="text" name="node_title" id="node_title" class="field" size="40" value="<if condition="isset( $arrValue )">{$arrValue['node_title']}</if>"/>
            <div class="description"><lang>节点的别名</lang></div></td>
          </tr>
          <tr>
            <th valign="top"><label for="group_id"><lang>分组</lang>：</label></th>
            <td><SELECT class="field"  name="group_id" id="group_id">
                 <foreach for=arrGroup>
	             <option value="{$value['group_id']}" {if isset( $arrValue ) && $value['group_id']==$arrValue['group_id']}selected{/if}>{$value['group_title']}</option>
	             </foreach>
	           </SELECT>
	           <div class="description"><lang>节点的分组</lang></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="node_status"><lang>状态</lang>：</label></th>
            <td><SELECT class="field"  name="node_status">
	             <option value="1" <if condition="isset( $arrValue ) && $arrValue['node_status']==1">selected</if>><lang>启用</lang></option>
	             <option value="0" <if condition="!isset( $arrValue ) || ( isset( $arrValue ) && $arrValue['node_status'] eq 0 ) ">selected</if>><lang>禁用</lang></option>
	           </SELECT>
	           <div class="description"><lang>是否启用节点，启用节点才能够使用</lang></div>
            </td>
          </tr>
          <tr>
            <th valign="top"><label for="node_remark"><lang>备注</lang>：</label></th>
            <td><textarea name="node_remark" id="node_remark" class="field" cols="70" rows="5"><if condition="isset( $arrValue )">{$arrValue['node_remark']}</if></textarea>
            <div class="description"><lang>节点其它相关信息</lang></div></td>
          </tr>

          </table>
          <p class="center"><input type="hidden" name="ajax" value="1">
          <input type="hidden" name="id" id="id" value="<if condition="isset( $nId )">{$nId}</if>"/>
          <input type="button" onclick="<if condition="!empty( $nId )" >update()<else/>add()</if>"  class="button" value="<if condition="!empty( $nId )" >  <lang>更  新</lang><else/>  <lang>发  布</lang></if>  " />
          <input type="reset" class="button" value="  <lang>重  置</lang>  " />
        </p>
        </form>
   </div>
   <!-- end content -->

<include file="public+footer">